package TCP;

import java.io.IOException;
import java.io.OutputStream;
import java.net.Socket;

public class Client {
    //客户端发送数据
    public static void main(String[] args) throws IOException {
        //创建客户端套接字
        Socket socket = new Socket("127.0.0.1",10086);
        //获取输出流
        OutputStream os = socket.getOutputStream();
        //发送数据
        os.write("hello world".getBytes());
        //关闭资源
        os.close();
        socket.close();
    }
}
